package com.model.dao;

// Generated Nov 27, 2013 4:26:26 PM by Hibernate Tools 4.0.0

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Home object for domain model class Level2Table.
 * @see com.model.Level2Table
 * @author Hibernate Tools
 */
@Stateless
public class Level2TableHome {

	private static final Log log = LogFactory.getLog(Level2TableHome.class);

	@PersistenceContext
	private EntityManager entityManager;

	public void persist(Level2Table transientInstance) {
		log.debug("persisting Level2Table instance");
		try {
			entityManager.persist(transientInstance);
			log.debug("persist successful");
		} catch (RuntimeException re) {
			log.error("persist failed", re);
			throw re;
		}
	}

	public void remove(Level2Table persistentInstance) {
		log.debug("removing Level2Table instance");
		try {
			entityManager.remove(persistentInstance);
			log.debug("remove successful");
		} catch (RuntimeException re) {
			log.error("remove failed", re);
			throw re;
		}
	}

	public Level2Table merge(Level2Table detachedInstance) {
		log.debug("merging Level2Table instance");
		try {
			Level2Table result = entityManager.merge(detachedInstance);
			log.debug("merge successful");
			return result;
		} catch (RuntimeException re) {
			log.error("merge failed", re);
			throw re;
		}
	}

	public Level2Table findById(Integer id) {
		log.debug("getting Level2Table instance with id: " + id);
		try {
			Level2Table instance = entityManager.find(Level2Table.class, id);
			log.debug("get successful");
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}
}
